#pragma once

#include "DM/Core/Window.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>

#include "DM/Renderer/GraphicsContext.h"

namespace DM {

	class DM_API WindowsWindow: public Window
	{
	public:
		WindowsWindow(const WindowProps& props);

		virtual ~WindowsWindow();

		void OnUpdate() override;

		inline unsigned int GetWidth() const override { return m_Data.Width; }
		inline unsigned int GetHeight() const override { return m_Data.Height; }

		inline void SetEventCallback(const EventCallbackFn& callback) override { m_Data.EventCallback = callback; }
		void SetVSync(bool enable) override;
		bool IsVSync() const override;
		void* GetNativeWindow() const override;

	private:
		virtual void Init(const WindowProps& props);
		virtual void Shutdown();
	private:
		GLFWwindow *m_Window;
		Scope<GraphicsContext> m_Context;
		struct WindowData
		{
			std::string Title;
			int Width;
			int Height;

			bool VSync;

			EventCallbackFn EventCallback;
		};

		WindowData m_Data;
	};

}
